package temp.lho.lws.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import temp.lho.lws.service.IMenuService;
import temp.lho.lws.vo.LoginVo;
import temp.lho.lws.vo.MenuInfo;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author liuws
 * @create 2020-06-27 17:22
 */
@RestController
@RequestMapping("/menu")
public class MenuController {

    @Autowired
    private IMenuService menuService;

    @GetMapping("/initMenu")
    public List<MenuInfo> initMenu(HttpSession session){

        LoginVo user = (LoginVo) session.getAttribute("user");

        return menuService.findUserMenu(user.getUserId());
    }
}
